import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop046_添加积分规则"

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"客户管理","管理积分","积分规则")
firefox.find_element_by_link_text("添加新规则").click()
firefox.find_element_by_id("integral_rule_name").send_keys("遵守规则")
firefox.find_element_by_id("integral_rule_info").send_keys("1111")
firefox.find_element_by_id("integral_rule_start_time").send_keys("2020-07-13 09:34")
firefox.find_element_by_id("integral_rule_end_time").send_keys("2020-07-31 09:34")
firefox.find_element_by_link_text("积分规则").click()
firefox.find_element_by_id("shopping_amount").send_keys("1000")
firefox.find_element_by_id("integral_num").send_keys("100")
firefox.find_element_by_link_text("选择客户组").click()
firefox.find_element_by_link_text("选择商品").click()
firefox.find_element_by_xpath("//button").click()

try:
    firefox.find_element_by_xpath("//td[text()='遵守规则']")
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
